package com.kitchen.ui.controls.account
{
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.display.Sprite;

	internal class ExpProcess extends Sprite
	{
		public var crate:Number;
		public var trate:Number;
		private var lmask:Shape;
		private var rwidth:int;
		public function ExpProcess(main:BitmapData, rate:Number=0)
		{
			super();
			this.crate = rate;
			this.layout(main);
		}
		
		private function layout(main:BitmapData):void{
			var bg:ExpLoadBgIcon = new ExpLoadBgIcon(main);
			this.addChild(bg);
			var load:Sprite = new Sprite();
			var licon:ExpProcessIcon = new ExpProcessIcon(main);
			load.addChild(licon);
			licon.x = 2;
			this.rwidth = licon.w;
			this.lmask = new Shape();
			this.lmask.graphics.beginFill(0xffffff, 1);
			this.lmask.graphics.drawRect(0, 0, licon.w, licon.h);
			this.lmask.graphics.endFill();
			load.mask = this.lmask;
			this.lmask.x = -((1-this.crate)*this.rwidth);
			load.addChild(this.lmask);
			this.addChild(load);
		}
		
		public function show(rate:Number):void{
			this.trate = rate;
			if(this.trate != this.crate){
				this.lmask.x = -((1-this.trate)*this.rwidth);
				this.crate = this.trate;
			}
		}
		
	}
}